#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cstring>
#include<string>
#define endl "\n"
using namespace std;
int gt(string a);
int main()
{
	string a;
	string b = "#";
	while (1)
	{
		cin >> a;
		if (a != b)
		{
			cout << gt(a) << endl;
		}
		else
			break;
	}
	return 0;
}
int gt(string a)
{
	map<string, int>mp;
	int k = 0;
	while (1)
	{
		mp[a]++;
		if (mp[a] == 1)
			k++;
		if (getchar() == '\n')
			break;
			cin >> a;

	}
	return k;
}